﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DAL_EF
{
    public class EntityConverter
    {
        public static List<Model.Teacher> ToModelTeacher(List<Teacher> inputList)
        {
            List<Model.Teacher> teacherList = new List<Model.Teacher>();
            foreach (Teacher t in inputList)
            {
                Model.Teacher teacher = new Model.Teacher();
                teacher.TeacherId = t.TeacherId;
                teacher.TeacherName = t.TeacherName;
                teacher.DepartmentId = t.DepartmentId;
                teacher.TeacherGender = t.TeacherGender;
                teacherList.Add(teacher);
            }
            return teacherList;
        }
        public static List<Model.Course> ToModelCourse(List<Course> inputList)
        {
            List<Model.Course> courseList = new List<Model.Course>();
            foreach (Course t in inputList)
            {
                Model.Course course = new Model.Course();
                course.CourseId = t.CourseId;
                course.CourseName = t.CourseName;
                //course.TeacherId = t.TeacherId;
                course.LevelId = t.LevelId;
                courseList.Add(course);
            }
            return courseList;
        }
        public static List<Model.Level> ToModelCourseLevel(List<Level> inputList)
        {
            List<Model.Level> levelList = new List<Model.Level>();
            foreach (Level l in inputList)
            {
                Model.Level level = new Model.Level();
                level.LevelId = l.LevelId;
                level.LevelName = l.LevelName;
                levelList.Add(level);
            }
            return levelList;
        }
        public static List<Model.Student> ToModelStudent(List<Student> inputList)
        {
            List<Model.Student> studentList = new List<Model.Student>();
            foreach(Student s in inputList)
            {
                Model.Student student = new Model.Student();
                student.StudentId = s.StudentId;
                student.StudentName = s.StudentName;
                studentList.Add(student);
            }
            return studentList;
        }
        public static List<Model.Level> ToModelLevel(List<Level> inputlist)
        {
            List<Model.Level> levelList = new List<Model.Level>();
            foreach (Level l in inputlist)
            {
                Model.Level level = new Model.Level();
                level.LevelId = l.LevelId;
                level.LevelName = l.LevelName;
                levelList.Add(level);
            }
            return levelList;
        }
        public static DAL_EF.Course ToEFCourse(Model.Course input)
        {
            DAL_EF.Course courses = new DAL_EF.Course();
            courses.CourseId = input.CourseId;
            courses.CourseName = input.CourseName;
            courses.CourseStatus = true;
            courses.TeacherId = input.TeacherId;
            courses.LevelId = input.LevelId;
            return courses;

        }
     
        public static DAL_EF.CourseDetail ToEFCourseDetails(Model.CourseDetails cd)
        {
            DAL_EF.CourseDetail coursedetails = new DAL_EF.CourseDetail();
            coursedetails.CourseDetailId=cd.CourseDetailId;
            coursedetails.CourseId=cd.CourseId;
            coursedetails.StudentId=cd.StudentId;
            return coursedetails;
            
        }
        
      
    }
    
}
